home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_srgp.lha / srgp / examples / show_patterns.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-09  |  1.3 KB  |  66 lines

  1. #include "srgp.h"
  2.  
  3. #define chipwidth 40
  4. #define chipheight 40
  5. #define vertmarg 10
  6. #define horizmarg 40
  7.  
  8. int i, x, y;
  9. int whichdev;
  10. char str[10];   
  11.  
  12. ShowPat (num, numstr)
  13. int num;
  14. char *numstr;
  15. {
  16.    SRGP_setFillBitmapPattern (num);
  17.    SRGP_fillRectangleCoord (x, y, x + chipwidth, y + chipheight);
  18.    SRGP_text (SRGP_defPoint(x + chipwidth+4, y+8), numstr);
  19.    y = y + chipheight+vertmarg;
  20. }
  21.  
  22. main()
  23. {
  24.    SRGP_begin ("SRGP Patterns", 950,720, 2, FALSE);
  25.    SRGP_text (SRGP_defPoint(5, 700),
  26.           "SRGP patterns (drawn in black in REPLACE mode)");
  27.    SRGP_text (SRGP_defPoint(5, 680),
  28.           "On far right, use of color is shown.");
  29.    SRGP_text (SRGP_defPoint(45, 660), "Hit any key to exit...");
  30.  
  31.    x = 5;
  32.    y = 5;
  33.  
  34.  
  35.    SRGP_setFillStyle (BITMAP_PATTERN_OPAQUE);
  36.  
  37.    for (i=0; i<=104; i++) {
  38.       sprintf (str, "%2d", i);
  39.       ShowPat(i, str);
  40.       if (y > 600) {
  41.      y = 5;
  42.      x = x + chipwidth + horizmarg;
  43.       }
  44.    }
  45.  
  46.    SRGP_loadCommonColor (2, "red");
  47.    SRGP_loadCommonColor (3, "blue");
  48.    SRGP_setColor (2);
  49.    SRGP_setBackgroundColor (3);
  50.  
  51.    y = 5;
  52.    x = x + chipwidth + horizmarg;
  53.  
  54.    for (i=0; i<=35; i++) {
  55.       sprintf (str, "%2d", i);
  56.       ShowPat(i, str);
  57.       if (y > 600) {
  58.      y = 5;
  59.      x = x + chipwidth + horizmarg;
  60.       }
  61.    }
  62.    SRGP_setKeyboardProcessingMode (RAW);
  63.    SRGP_setInputMode (KEYBOARD, EVENT);
  64.    whichdev = SRGP_waitEvent(-1);
  65. }
  66.